package com.googlecode.YaccSyntaxTool.export;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeMap;

public class ReferenceMap extends TreeMap<String,Set<String>> { // use a SortedMap!

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	public void addReference(String key, String refFrom) {
		Set<String>		references = null;

		if (this.containsKey(key)) {
			references = this.get(key);
		} else {
			references = new HashSet<String>();
			this.put(key, references);
		}
		if (references != null) {
			references.add(refFrom);
		}
	}
}
